const express = require('express')
const router = express.Router()
const middleware = require('../middleware/logincheck')
// 先验证有没有登录
router.use(middleware)

router.get('/',(req,res)=>{
    if(req.session.uname && req.session.upwd){
        
        let user = {
            uname:req.session.uname,
            upwd:req.session.upwd
        }
        res.render('index',{user})
    }else{
        res.render('index',{user:null})
    }
})

module.exports=router